Skip to main content

Class PollingSensorBase<UNIT>

Base class that represents a sampling sensor to support the observable pattern

Assembly: Meadow.Foundation.dll
View Source
Declaration
public abstract class PollingSensorBase<UNIT> : SamplingSensorBase<UNIT>, IObservable<IChangeResult<UNIT>>, ISamplingSensor<UNIT>, ISensor<UNIT>, ISensor, ISamplingSensor where UNIT : struct

Inheritance: System.Object -> Meadow.Foundation.ObservableBase<UNIT>

Derived:

Expand

Implements:
System.IObservable<Meadow.IChangeResult<<UNIT>>>, Meadow.Peripherals.Sensors.ISamplingSensor<<UNIT>>, Meadow.Peripherals.Sensors.ISensor<<UNIT>>, Meadow.Peripherals.Sensors.ISensor, Meadow.Peripherals.Sensors.ISamplingSensor

Methods

StartUpdating(TimeSpan?)

Starts updating the sensor on the updateInterval frequency specified.

This method also starts raising Updated events and notifying IObservable subscribers. Use the updateInterval parameter to specify how often events and notifications are raised/sent.

View Source
Declaration
public override void StartUpdating(TimeSpan? updateInterval = null)
Parameters
TypeNameDescription
System.Nullable<System.TimeSpan>updateIntervalA TimeSpan that specifies how long to
 wait between readings. This value influences how often `*Updated`
events are raised and `IObservable` consumers are notified.
The default is 5 seconds. |

StopUpdating()

Stops sampling the sensor

View Source
Declaration
public override void StopUpdating()

Implements

  • System.IObservable<Meadow.IChangeResult<<UNIT>>>
  • Meadow.Peripherals.Sensors.ISamplingSensor<<UNIT>>
  • Meadow.Peripherals.Sensors.ISensor<<UNIT>>
  • Meadow.Peripherals.Sensors.ISensor
  • Meadow.Peripherals.Sensors.ISamplingSensor